feat: connect the search field and the results of the Elements page to searchCatalog #118
+733
−176
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The Elements page now shows real results from the API, and the search field works. This is the first part of #110 (the page is made to work in parts, in several pull requests): the search and the results. The filters, the sort and "Load more" are still only drawn, and say that they are not connected yet.
Part of #110 (the one issue for making the whole Elements page work, in several pull requests).
Stacked on #114 (the base is
41-elements-page-ui, which has the design). Change the base todevwhen #114 is merged, before merging this. The "Files changed" tab only shows this pull request until then.What is in it
searchOperations.ts: theSearchCatalogquery (typed by hand, likecatalogOperations.ts) andtoListRow, which makes a row of the table and the cards from a result: the apparatus and the group fromelementGroup,valueordValue,imageUrl, andhasVariantsfromvariants.first: 20) ofsearchCatalogthrough Apollo Client, in the table and in the cards. "Showing X of Y" usestotalCount(the page showed 20 of 562 on the real backend).BAD_USER_INPUTfor more, and for more than 8 words; the message of the server is shown).?search=yurchenko,useSearchParams), so a result can be shared. The field follows the address when the user goes back or forward.previousData), so the page does not jump.role="status",aria-busyon the results), error (the message ofdescribeError, with "Try again" when trying again can help) and nothing found ("No elements match “zzz”.", a status a screen reader reads).exampleElementRowsandsrc/lib/elementList.tsno longer have the example data. The seven real rows are insrc/tests/elementRows.ts, for the tests.docs/AI_USAGE.md.Testing
npx vitest run: 41 files, 392 tests passed. New: 17 for the page on the real Apollo Client with a stub forfetch(the first request, the fields of the API in each row, loading, empty, error with and without "Try again", the debounce, the address both ways, Enter, the old results that stay, the group number of a vault, the controls), 2 fortoListRow.eslint,tsc -bandnpm run buildpass.yurchenko(1 result, the address changes), no result, a search from the address, and 9 words (the message of the server).Open points
description(see feat: build the Elements page: the design, the search, the results and Load more #114). The page shows what the data has.🤖 Generated with Claude Code